/*
 * File:   F02.h
 * Author: jcrada
 *
 * Created on 30 May 2011, 10:53 AM
 */

#ifndef ECB_CEC10_F02_H
#define	ECB_CEC10_F02_H

#include "ecb/benchmarks/cec10/CecProblem.h" 

#include "ecb/benchmarks/cec10/CecMath.h"
#include "ecb/operator/Shifted.h"
#include "ecb/function/Rastrigin.h"


namespace ecb {
    namespace cec10 {

        class F02 : public CecProblem {
        private:
            Function* rastrigin;
        public:

            F02(int dimensions)
            : CecProblem("F02", "Shifted Rastrigin's Function", dimensions,
            -5, 5, true, 0, new CecRandom(2l)) {
                std::vector<scalar> shift = CecMath::ShiftVector(dimensions, _properties->getMinimum(),
                        _properties->getMaximum(), randomizer());
                rastrigin = new Shifted(shift, 0, new Rastrigin());
            }

            ~F02() {
                delete rastrigin;
            }

            scalar f(const std::vector<scalar>& x) {
                return rastrigin->f(x);
            }
        };
    }
}

#endif	/* ECB_CEC10_F02_H */

